using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Easislides
{
	public class FrmCopy : Form
	{
		private IContainer components = null;
		private Button BtnCancel;
		private Button BtnOK;
		private ListView SongFolder;
		private Label Label1;
		private ColumnHeader columnHeader1;
		private RadioButton optCopyToInfoScreen;
		private RadioButton optCopyToFolder;
		private ListView ExternalFilesFolder;
		private ColumnHeader columnHeader2;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
            this.BtnCancel = new System.Windows.Forms.Button();
            this.BtnOK = new System.Windows.Forms.Button();
            this.SongFolder = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.Label1 = new System.Windows.Forms.Label();
            this.optCopyToInfoScreen = new System.Windows.Forms.RadioButton();
            this.optCopyToFolder = new System.Windows.Forms.RadioButton();
            this.ExternalFilesFolder = new System.Windows.Forms.ListView();
            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.SuspendLayout();
            // 
            // BtnCancel
            // 
            this.BtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.BtnCancel.Location = new System.Drawing.Point(218, 190);
            this.BtnCancel.Name = "BtnCancel";
            this.BtnCancel.Size = new System.Drawing.Size(80, 24);
            this.BtnCancel.TabIndex = 3;
            this.BtnCancel.Text = "Cancel";
            this.BtnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
            // 
            // BtnOK
            // 
            this.BtnOK.Location = new System.Drawing.Point(122, 190);
            this.BtnOK.Name = "BtnOK";
            this.BtnOK.Size = new System.Drawing.Size(80, 24);
            this.BtnOK.TabIndex = 2;
            this.BtnOK.Text = "OK";
            this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
            // 
            // SongFolder
            // 
            this.SongFolder.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1});
            this.SongFolder.FullRowSelect = true;
            this.SongFolder.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
            this.SongFolder.HideSelection = false;
            this.SongFolder.Location = new System.Drawing.Point(11, 64);
            this.SongFolder.MultiSelect = false;
            this.SongFolder.Name = "SongFolder";
            this.SongFolder.Size = new System.Drawing.Size(196, 117);
            this.SongFolder.TabIndex = 0;
            this.SongFolder.UseCompatibleStateImageBehavior = false;
            this.SongFolder.View = System.Windows.Forms.View.Details;
            this.SongFolder.DoubleClick += new System.EventHandler(this.SongFolder_DoubleClick);
            this.SongFolder.KeyUp += new System.Windows.Forms.KeyEventHandler(this.SongFolder_KeyUp);
            this.SongFolder.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SongFolder_MouseUp);
            // 
            // columnHeader1
            // 
            this.columnHeader1.Width = 180;
            // 
            // Label1
            // 
            this.Label1.Location = new System.Drawing.Point(13, 8);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(399, 34);
            this.Label1.TabIndex = 4;
            this.Label1.Text = "label1";
            // 
            // optCopyToInfoScreen
            // 
            this.optCopyToInfoScreen.AutoSize = true;
            this.optCopyToInfoScreen.Location = new System.Drawing.Point(218, 45);
            this.optCopyToInfoScreen.Name = "optCopyToInfoScreen";
            this.optCopyToInfoScreen.Size = new System.Drawing.Size(120, 17);
            this.optCopyToInfoScreen.TabIndex = 9;
            this.optCopyToInfoScreen.Text = "Copy To InfoScreen";
            this.optCopyToInfoScreen.UseVisualStyleBackColor = true;
            // 
            // optCopyToFolder
            // 
            this.optCopyToFolder.AutoSize = true;
            this.optCopyToFolder.Checked = true;
            this.optCopyToFolder.Location = new System.Drawing.Point(17, 44);
            this.optCopyToFolder.Name = "optCopyToFolder";
            this.optCopyToFolder.Size = new System.Drawing.Size(149, 17);
            this.optCopyToFolder.TabIndex = 10;
            this.optCopyToFolder.TabStop = true;
            this.optCopyToFolder.Text = "Copy To Database Folder:";
            this.optCopyToFolder.UseVisualStyleBackColor = true;
            // 
            // ExternalFilesFolder
            // 
            this.ExternalFilesFolder.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader2});
            this.ExternalFilesFolder.FullRowSelect = true;
            this.ExternalFilesFolder.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
            this.ExternalFilesFolder.HideSelection = false;
            this.ExternalFilesFolder.Location = new System.Drawing.Point(213, 64);
            this.ExternalFilesFolder.MultiSelect = false;
            this.ExternalFilesFolder.Name = "ExternalFilesFolder";
            this.ExternalFilesFolder.Size = new System.Drawing.Size(196, 117);
            this.ExternalFilesFolder.TabIndex = 1;
            this.ExternalFilesFolder.UseCompatibleStateImageBehavior = false;
            this.ExternalFilesFolder.View = System.Windows.Forms.View.Details;
            this.ExternalFilesFolder.DoubleClick += new System.EventHandler(this.ExternalFilesFolder_DoubleClick);
            this.ExternalFilesFolder.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ExternalFilesFolder_KeyUp);
            this.ExternalFilesFolder.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ExternalFilesFolder_MouseUp);
            // 
            // columnHeader2
            // 
            this.columnHeader2.Width = 180;
            // 
            // FrmCopy
            // 
            this.AcceptButton = this.BtnOK;
            this.CancelButton = this.BtnCancel;
            this.ClientSize = new System.Drawing.Size(419, 227);
            this.Controls.Add(this.optCopyToInfoScreen);
            this.Controls.Add(this.optCopyToFolder);
            this.Controls.Add(this.ExternalFilesFolder);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.SongFolder);
            this.Controls.Add(this.BtnCancel);
            this.Controls.Add(this.BtnOK);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FrmCopy";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Copy item(s) to another folder";
            this.Load += new System.EventHandler(this.FrmCopy_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		public FrmCopy()
		{
			this.InitializeComponent();
		}
		private void FrmCopy_Load(object sender, EventArgs e)
		{
			this.Label1.Text = string.Concat(new object[]
			{
				"You have selected ",
				gf.SelectedItemsCount,
				" item",
				(gf.SelectedItemsCount > 1) ? "s" : "",
				" for Copy. Please select appropriate folder to copy the item",
				(gf.SelectedItemsCount > 1) ? "s" : "",
				" to, and then click OK."
			});
			gf.CopyToFolder = -1;
			this.SongFolder.Items.Clear();
			for (int i = 1; i <= 40; i++)
			{
				if (gf.FolderUse[i] > 0)
				{
					this.SongFolder.Items.Add(gf.FolderName[i]);
				}
			}
			this.ExternalFilesFolder.Items.Clear();
			for (int i = 0; i < gf.InfoScreenFolderTotal; i++)
			{
				this.ExternalFilesFolder.Items.Add(gf.InfoScreenGroups[i, 0]);
			}
		}
		private void BtnOK_Click(object sender, EventArgs e)
		{
			if (this.optCopyToFolder.Checked)
			{
				if (this.SongFolder.Items.Count > 0)
				{
					if (this.SongFolder.SelectedItems.Count > 0)
					{
						gf.CopyToFolder = gf.GetFolderNumber(this.SongFolder.SelectedItems[0].Text);
						base.DialogResult = DialogResult.OK;
						base.Close();
					}
					else
					{
						MessageBox.Show("Please select a folder to copy the songs to!");
					}
				}
				else
				{
					MessageBox.Show("There are no Song Folders enabled!");
				}
			}
			else
			{
				if (this.ExternalFilesFolder.SelectedItems.Count > 0)
				{
					gf.CopyToFolder = -1 * (1 + gf.GetSelectedIndex(this.ExternalFilesFolder));
					base.DialogResult = DialogResult.OK;
					base.Close();
				}
				else
				{
					MessageBox.Show("Please select a folder to copy the songs to!");
				}
			}
		}
		private void SongFolder_DoubleClick(object sender, EventArgs e)
		{
			this.SelectOptCopyToFolder(0);
			this.BtnOK.PerformClick();
		}
		private void SongFolder_KeyUp(object sender, KeyEventArgs e)
		{
			this.SelectOptCopyToFolder(0);
		}
		private void SongFolder_MouseUp(object sender, MouseEventArgs e)
		{
			this.SelectOptCopyToFolder(0);
		}
		private void ExternalFilesFolder_DoubleClick(object sender, EventArgs e)
		{
			this.SelectOptCopyToFolder(1);
			this.BtnOK.PerformClick();
		}
		private void ExternalFilesFolder_KeyUp(object sender, KeyEventArgs e)
		{
			this.SelectOptCopyToFolder(1);
		}
		private void ExternalFilesFolder_MouseUp(object sender, MouseEventArgs e)
		{
			this.SelectOptCopyToFolder(1);
		}
		private void SelectOptCopyToFolder(int SelectedOpt)
		{
			if (SelectedOpt == 0)
			{
				this.optCopyToFolder.Checked = true;
			}
			else
			{
				this.optCopyToInfoScreen.Checked = true;
			}
		}

        private void BtnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }
	}
}
